package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.entity.PromotionEntity;
import com.project.service.IPromotionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("promotion")
public class PromotionController {

    @Autowired
    private IPromotionService service;

    @RequestMapping("findByItem")
    public IPage<PromotionEntity> findByItem(Integer pageNO, int status, int pageSize) {
        return service.findByItem(pageNO,status,pageSize);
    }

    @RequestMapping("findById")
    public PromotionEntity findById(Integer id) {
        return service.findById(id);
    }

    @RequestMapping("updateStatus")
    public String updateStatus(Integer customerId, int status,String cause) {
        service.updateStatus(customerId, status,cause);
        return "ok";
    }
}
